<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input type="text" id="input1" />
    <script>
      const input1 = document.getElementById("input1");

      // input1.onfocus = function () {
      //   console.log("onfocus");
      // };
      // input1.onblur = function () {
      //   console.log("onblur");
      // };

      input1.addEventListener("focusin", () => {
        console.log("focusein");
      });

      input1.addEventListener("focusout", () => {
        console.log("focuseout");
      });
      setTimeout(() => {
        input1.focus();
        setTimeout(() => {
          input1.blur();
        }, 2000);
      }, 3000);
    </script>
  </body>
</html>
